rendernodepaintable: Use new snapshot transforms
authorBenjamin Otte <otte@redhat.com>
Thu, 21 Feb 2019 04:34:12 +0000 (05:34 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 21 Feb 2019 18:47:28 +0000 (19:47 +0100)
gtk/gtkrendernodepaintable.c

index 8e67150a375845bd40a99240a2c3b2621bed942d..2a85de2aad8bb389242d9612e498e3c9ea24a1be 100644 (file)
@@ -43,28 +43,17 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable,
                                               double        height)
 {
   GtkRenderNodePaintable *self = GTK_RENDER_NODE_PAINTABLE (paintable);
-  gboolean needs_transform;
 
   if (self->bounds.size.width <= 0 ||
       self->bounds.size.height <= 0)
     return;
 
-  needs_transform = self->bounds.size.width != width ||
-                    self->bounds.size.height != height;
+  gtk_snapshot_save (snapshot);
 
-  if (needs_transform)
-    {
-      graphene_matrix_t transform;
-
-      graphene_matrix_init_scale (&transform,
-                                  width / (self->bounds.size.width),
-                                  height / (self->bounds.size.height),
-                                  1.0);
-      gtk_snapshot_push_transform (snapshot,
-                                   &transform);
-    }
-
-  gtk_snapshot_offset (snapshot, -self->bounds.origin.x, -self->bounds.origin.y);
+  gtk_snapshot_scale (snapshot,
+                      width / (self->bounds.size.width),
+                      height / (self->bounds.size.height));
+  gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (-self->bounds.origin.x, -self->bounds.origin.y));
 
   gtk_snapshot_push_clip (snapshot, &self->bounds);
 
@@ -73,10 +62,7 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable,
 
   gtk_snapshot_pop (snapshot);
 
-  gtk_snapshot_offset (snapshot, self->bounds.origin.x, self->bounds.origin.y);
-
-  if (needs_transform)
-    gtk_snapshot_pop (snapshot);
+  gtk_snapshot_restore (snapshot);
 }
 
 static GdkPaintableFlags